package com.yanqu.road.server.cmd.activity.doublespring.cross;

import com.yanqu.road.entity.activity.doublespring.DoubleSpringActivityConfig;
import com.yanqu.road.entity.activity.doublespring.enums.DoubleSpringLogInviteTypeEnum;
import com.yanqu.road.entity.log.doublespring.LogActivityDoubleSpringInvite;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.DoubleSpringProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.PreReduceModule;
import com.yanqu.road.server.manger.activity.doublespring.DoubleSpringActivityMgr;
import com.yanqu.road.server.manger.log.AutoLogMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_DOUBLE_SPRING_INVITE_USER_FROM_CROSS,desc = "踏春游记-跨服返回-邀请玩家")
public class DoubleSpringInviteUserFromCrossCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        DoubleSpringProto.DoubleSpringInviteCrossToServerMsg reqMsg = DoubleSpringProto.DoubleSpringInviteCrossToServerMsg.parseFrom(packet.getBytes());
        //日志
        LogActivityDoubleSpringInvite log = new LogActivityDoubleSpringInvite();
        log.setActivityId(reqMsg.getActivityId());
        log.setUserId(player.getUserId());
        log.setInviteUserId(reqMsg.getInviteUserId());
        log.setType(DoubleSpringLogInviteTypeEnum.TYPE_INVITE.getType());
        log.setCreateTime(System.currentTimeMillis());
        AutoLogMgr.add(log);
        //返回
        DoubleSpringProto.DoubleSpringInviteUserRespMsg.Builder respMsg = DoubleSpringProto.DoubleSpringInviteUserRespMsg.newBuilder();
        respMsg.setRet(0);
        player.sendPacket(Protocol.U_DOUBLE_SPRING_INVITE_USER, respMsg);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
